Skip to content

fix(benchmark): add FrameTimingMetric to View cold-start benchmark - #25

Merged
e-Garcia merged 2 commits into
mainfrom
fix/view-coldstart-frametiming
Jul 24, 2026
Merged

fix(benchmark): add FrameTimingMetric to View cold-start benchmark#25
e-Garcia merged 2 commits into
mainfrom
fix/view-coldstart-frametiming

Conversation

@e-Garcia

@e-Garcia e-Garcia commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds FrameTimingMetric() to ViewBenchmarks.coldStartup_view()
  • Previously only StartupTimingMetric was used — an incomplete measurement
  • Now matches Compose's measurement strategy (both metrics) for fair comparison

Changes

  • benchmark/src/main/java/dev/egarcia/andperf/benchmark/ViewBenchmarks.kt: Added FrameTimingMetric() to coldStartup_view()
  • benchmark-results.md: Updated with new benchmark results (all 5 tests pass on generic API 36 emulator)

Results (Generic API 36 Emulator)

Cold Start — timeToInitialDisplayMs (median)

  • View (RecyclerView): 380ms
  • Compose (LazyColumn): 670ms
  • View is ~35% faster on cold-start median

Cold Start — Frame Duration P90 (CPU)

  • View (RecyclerView): 208ms
  • Compose (LazyColumn): 338ms
  • View shows lower tail latencies during cold start

Fast Scroll (500 items)

  • View P50: 6.9ms | Compose P50: 7.5ms (~identical)
  • View P95: 22.6ms | Compose P95: 22.7ms (~identical)

Verification

  • All 5 benchmark tests pass on a generic API 36 emulator (Android 16, x86_64)
  • Emulator results are for development iteration; physical device testing required for production conclusions

@e-Garcia
e-Garcia force-pushed the fix/view-coldstart-frametiming branch from adefa3a to 8f21384 Compare July 23, 2026 16:45
The View cold-start test only measured StartupTimingMetric, making it
incomplete compared to the Compose benchmark which uses both metrics.

This fix:
- Adds FrameTimingMetric() to ViewBenchmarks.coldStartup_view()
- Matches Compose's measurement strategy for apples-to-apples comparison
- Validates via generic API 36 emulator (x86_64) - all 5 tests pass

View shows ~35% faster cold-start TTI (380ms vs 670ms) and lower P90
frame durations (208ms vs 338ms) when both metrics are captured.
@e-Garcia
e-Garcia force-pushed the fix/view-coldstart-frametiming branch from 8f21384 to 69a23e7 Compare July 23, 2026 16:48
@e-Garcia
e-Garcia requested a review from Copilot July 23, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the View cold-start macrobenchmark with the Compose cold-start benchmark by collecting both startup timing and frame timing metrics, and updates the repository’s benchmark results write-up accordingly.

Changes:

  • Add FrameTimingMetric() to ViewBenchmarks.coldStartup_view() to match Compose’s cold-start metric set.
  • Update benchmark-results.md with refreshed emulator-run results and expanded reporting context.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
benchmark/src/main/java/dev/egarcia/andperf/benchmark/ViewBenchmarks.kt Adds frame timing to the View cold-start benchmark to enable apples-to-apples comparison with Compose.
benchmark-results.md Rewrites/expands the results document to reflect the new metric collection and updated measurements.
Comments suppressed due to low confidence (3)

benchmark-results.md:17

  • "Jetpack Compose (latest)" is ambiguous and makes results harder to reproduce. The repo pins Compose via a BOM version in the version catalog; consider including that BOM version here.
| UI Frameworks | Jetpack Compose (latest) vs Android Views (RecyclerView) |

benchmark-results.md:28

  • The test matrix lists "56 scrollable items" for cold start, but both apps build their lists from FakeRepo.items() whose default count is 1000. For accuracy/reproducibility, the matrix should reflect the actual dataset size (or explicitly say "~56 visible" if that's what is meant).
| coldStartup | Compose (LazyColumn) | Cold | 56 scrollable items | StartupTiming, FrameTiming |
| coldStartup | Android View (RecyclerView) | Cold | 56 scrollable items | StartupTiming, FrameTiming |

benchmark-results.md:31

  • The smoke test also uses the same default dataset (FakeRepo.items() => 1000). If "56" is meant to be visible rows rather than list size, consider clarifying; otherwise update to 1000 for correctness.
| Smoke | Compose (LazyColumn) | Cold | 56 scrollable items | StartupTiming (smoke) |

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +26
// Match ComposeBenchmarks: use both StartupTimingMetric and FrameTimingMetric
// for a fair apples-to-apples comparison of cold-start and scroll performance.
Comment thread benchmark-results.md
> **Device:** sdk_gphone64_x86_64 (Android 16, API 36, Emulator)
> **CPU:** 4 cores @ 2GHz, 2GB RAM
> **Date:** 2026-07-23
> **Test harness:** AndroidX Benchmark Macrobenchmark (Jitpack)
Test Matrix listed 56/500 items, but both apps call FakeRepo.items()
with the default count of 1000 for every benchmark.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

benchmark-results.md:6

  • The note "(Jitpack)" appears to be inaccurate: there are no references to JitPack in the repo, and the benchmark dependency is androidx.benchmark (from Google/AndroidX). This could mislead readers about how the benchmark library is sourced.
> **Test harness:** AndroidX Benchmark Macrobenchmark (Jitpack)

Comment on lines 34 to 37
} catch (t: Throwable) {
// Device may not surface frame metrics — skip gracefully rather than fail.
Assume.assumeTrue("Skipping benchmark due to metric error: ${t.message}", false)
}
Comment thread benchmark-results.md

---

## Fast Scroll (Warm Start) — 500 Items
@e-Garcia e-Garcia added this to the 1.0 milestone Jul 24, 2026
@e-Garcia
e-Garcia merged commit 6068cce into main Jul 24, 2026
1 check passed
@e-Garcia
e-Garcia deleted the fix/view-coldstart-frametiming branch July 24, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants